package com.twoandone.tms.realtime.publisher.mapper;

import com.twoandone.tms.realtime.publisher.bean.TransportCity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;


@Mapper
public interface TransportMapper {
    @Select("select count(*) total_count from dws_transport_truck_organ_window where toYYYYMMDD(stt)=#{date};")
    Long getTotalCount(Integer date);
    @Select("select province_name,count(*) province_count from dws_transport_truck_organ_window" +
            " where toYYYYMMDD(stt)=#{date} group by province_id,province_name ;")
    Long getProvinceCount(Integer date);
    @Select("select city_name cityName,sum(sum_distance) sumDistance from dws_transport_truck_organ_window where toYYYYMMDD(stt)=#{date} group by city_id,city_name order by sumDistance desc limit #{limit};")
//    @Select("select city_name cityName,sum(sum_distance) sumDistance from dws_transport_truck_organ_window where toYYYYMMDD(stt)=20230313 group by city_id,city_name;")
    List<TransportCity> getCityDistance(@Param(value = "date") Integer date,@Param(value = "limit") Integer limit);
}
